<template>
  <div>
    <!-- 卡片视图 -->
    <el-card>
      <el-upload
        action="http://localhost:9999/filmarea/importExcel"
        :on-success="uploadSuccess"
        :on-error="uploadError"
      >
        <el-button size="small" type="primary">导入</el-button>
      </el-upload>
      <el-button size="small" type="primary" @click="exportExcel"
        >导出</el-button
      >
    </el-card>
  </div>
</template>
<script>
export default {
  data() {
    return {};
  },
  created() {},
  methods: {
    uploadSuccess(res, file) {
      console.log(res);
      console.log(file);
      this.$message.success(res.message);
    },
    uploadError(error) {
      this.$message.success("导入失败");
    },
    exportExcel() {
      location.href = "http://127.0.0.1:9999/common/filmarea/exportToExcel";
    },
  },
};
</script>
<style lang="less" scoped>
</style>